package org.frog.sgs.mina.server;

import java.net.InetSocketAddress;

import org.apache.mina.filter.codec.ProtocolCodecFilter;
import org.apache.mina.filter.codec.textline.TextLineCodecFactory;
import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
import org.frog.sgs.consts.Constants;

/**
 * @author duanxiangqi
 * @date 2012-10-18
 */
public class Server {

	public static void main(String[] args) throws Exception {
		NioSocketAcceptor acceptor = new NioSocketAcceptor(1);

		acceptor.setHandler(new MyIoHandler());

		acceptor.getFilterChain().addLast("codec", new ProtocolCodecFilter(new TextLineCodecFactory()));

		acceptor.bind(new InetSocketAddress(14151));
		System.out.println("服务器启动完毕，监听端口：" + Constants.SERVER_PORT);
		System.out.println("等待玩家加入。。。");
	}
}
